﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ServiceStack.Redis;
using DevAwesome.WebDataBridge.StorageProviders;

namespace DevAwesome.WebDataBridge.StorageProviders {
    public class RedisStorageProvider : IWebDataBridgeStorageProvider {

        RedisClient redis = new RedisClient( );

        public bool Exists( string endPoint ) {
            return redis.ContainsKey( endPoint );
        }

        public T Read<T>( string endPoint ) where T : class {
            return redis.Get<T>( endPoint );
        }

        public void Update( string endpoint, object obj ) {
            redis.Set( endpoint, obj );
        }

    }
}
